package lab02.test37;

import java.util.Scanner;

public class StudentDemo {
    public static void main(String[] args) {
        Student[] students = new Student[2];
        students[0] = new Undergraduate();
        students[1] = new Graduate();
        System.out.print("请输入学生类型：");
        Scanner sc = new Scanner(System.in);
        String sort = sc.nextLine();


        System.out.println("请输入三科成绩：");

        int grade[] = new int[3];

        for (int i = 0; i < 3; i++) {

            int score = sc.nextInt();
            grade[i] = score;
        }


        if (sort.equals("本科生")) {
            students[0].calculateGrade(grade);

        } else if (sort.equals("研究生")) {
            students[1].calculateGrade(grade);
        }

    }


}
